package com.example.dirviesystem.student.controller;


import com.example.dirviesystem.entity.Question;
import com.example.dirviesystem.student.service.StudentQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/questions")
public class StudentQuestionController {

    @Autowired
    private StudentQuestionService studentQuestionService;

    @GetMapping("/all")
    public List<Question> getAllQuestions() {
        return studentQuestionService.getAllQuestions();
    }

    @GetMapping("/subject/{subject}")
    public List<Question> getQuestionsBySubject(@PathVariable String subject) {
        return studentQuestionService.getQuestionsBySubject(subject);
    }

    @GetMapping("/simulate/{subject}")
    public List<Question> getSimulateQuestions(@PathVariable String subject) {
        int limit = 100;
        return studentQuestionService.getRandomQuestionsBySubject(subject, limit);
    }
}